import { request } from './request'

// 添加购物车
export function addCart(data) {
  return request({
    url: '/api/carts',
    method: 'post',
    data
  })
}

// 购物车列表
export function getCartList(params) {
  return request({
    url: '/api/carts',
    params
  })
}

// 购物车数量改变
export function editCartNum(cartId) {
  return request({
    url: `/api/carts/${cartId}`,
    method: 'put'
  })
}

// 移出购物车
export function deleteCart(cartId) {
  return request({
    url: `/api/carts/${cartId}`,
    method: 'delete'
  })
}

// 购物车改变选中
export function checkedCart(data) {
  return request({
    url: '/api/carts/checked',
    method: 'patch',
    data
  })
}
